<%@page import="Course.CourseBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<!doctype html>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Fee_Deposit_Report").toString().equals("1")) {
%>
<%String to = "", status = "", msg = "", admissionId = "";%>
<%if (request.getParameter("admissionId") != null) {
        admissionId = request.getParameter("admissionId");
    }%>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Ramgovind Automated System</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/uniform.default.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <link rel="stylesheet" href="/RIT/css/jquery.cleditor.css">
        <link rel="stylesheet" href="/RIT/css/jquery.plupload.queue.css">
        <link rel="stylesheet" href="/RIT/css/jquery.tagsinput.css">
        <link rel="stylesheet" href="/RIT/css/jquery.ui.plupload.css">
        <link rel="stylesheet" href="/RIT/js/tableTools/css/TableTools.css">
        <link rel="stylesheet" href="/RIT/css/chosen.css">
        <link rel="stylesheet" href="/RIT/css/chosen.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <script src="/RIT/ajax/ajax.js"></script>
        <script type="text/javascript">
            function loadReport()
            {
                var course=document.getElementById('course').value;
                var sem=document.getElementById('semester').value;
                var stream=document.getElementById('stream').value;
                var xmlhttp;
                if (window.XMLHttpRequest)
                {
                    xmlhttp = new XMLHttpRequest();
                }
                else
                {
                    xmvlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }

                xmlhttp.onreadystatechange = function()
                {
                    if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                    {
                        document.getElementById('ctbody').innerHTML = xmlhttp.responseText
                    }
                }
                xmlhttp.open("POST", "/RIT/FeeDepositReport?course="+course+"&sem="+sem+"&stream="+stream, true);
                xmlhttp.send();
            }
        </script>
        <script type="text/javascript">
        var tableToExcel = (function() {
            var uri = 'data:application/vnd.ms-excel;base64,'
            , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
            , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
            , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
            return function(table, name) {
                if (!table.nodeType) table = document.getElementById(table)
                var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
                window.location.href = uri + base64(format(template, ctx))
            }
        })()
        </script>
    </head>
    <body onload="loadReport()">					
        <div id="ILoader"></div>
        <%@include file="/topheader.html" %>
        <%@include file="/reportheader.html" %>
        <div class="main">
            <div class="container-fluid">
                <%@include file="/Reports/reportsidenav.html" %>
                <div class="content">
                    <div class="row-fluid">
                        <div class="box">
                            <div class="box-head tabs">
                                <h3>Fees Deposit Report</h3>
                                <div style="float:right;display:flex">
                                    <div class="actions input-prepend">
                                        <ul>
                                            <li>
                                        <select name="course" id="course" class='{required:true}'onchange="getStream('stream', this.value)">
                                            <option value=''>Select Course</option>
                                            <%
                                                Vector<Object> list = Course.Query.viewAlldistinct();
                                                Iterator it = list.iterator();
                                                while (it.hasNext()) {
                                                    CourseBean cb = (CourseBean) it.next();
                                            %>
                                            <option value="<%=cb.getCourseName()%>"><%=cb.getCourseName()%></option>
                                            <%}%>
                                        </select>
                                            </li>
                                            <li>
                                        <select name="stream" id="stream" class='{required:true}' onchange="getSemester('course', this.options[this.selectedIndex].text)">
                                            <option value="">Select Stream</option>
                                        </select>
                                            </li>
                                            <li>
                                        <select name="semester" id="semester" class='{required:true}' onchange="getSubject(document.getElementById('stream').options[document.getElementById('stream').selectedIndex].text, this.value)">
                                            <option value="">Select Semester</option>
                                        </select>
                                                <span class="add-on" onclick="loadReport()"><a href="#" class="ficon-search"></a></span></li>
                                            <li><button style="height:30px" type="button" onclick="tableToExcel('ct', 'Fee Collection Report')"><img src="/RIT/img/icons/fugue/arrow-270.png" alt="Download" title="Download To Excel"></button></li>
                                        </ul>
                                    </div>

                                </div>
                            </div>
                            <div class="box-content box-nomargin">
                                <table class='table table-striped dataTable-noheader dataTable-nofooter table-bordered' id="ct">
                                    <thead>
                                        <tr>
                                            <th>Admission No</th>
                                            <th>Name</th>
                                            <th>Fees Type</th>
                                            <th>Date</th>
                                            <th>Amount</th>
                                        </tr>
                                    </thead>
                                    <tbody id="ctbody">

                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>	
            </div>
        </div>
    </div>	
    <script src="/RIT/js/jquery.js"></script>
    <script src="/RIT/js/less.js"></script>
    <script src="/RIT/js/bootstrap.min.js"></script>
    <script src="/RIT/js/jquery.uniform.min.js"></script>
    <script src="/RIT/js/bootstrap.timepicker.js"></script>
    <script src="/RIT/js/bootstrap.datepicker.js"></script>
    <script src="/RIT/js/chosen.jquery.min.js"></script>
    <script src="/RIT/js/jquery.fancybox.js"></script>
    <script src="/RIT/js/plupload/plupload.full.js"></script>
    <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
    <script src="/RIT/js/jquery.cleditor.min.js"></script>
    <script src="/RIT/js/jquery.inputmask.min.js"></script>
    <script src="/RIT/js/jquery.tagsinput.min.js"></script>
    <script src="/RIT/js/jquery.mousewheel.js"></script>
    <script src="/RIT/js/jquery.dataTables.min.js"></script>
    <script src="/RIT/js/jquery.dataTables.bootstrap.js"></script>
    <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
    <script src="/RIT/js/ui.spinner.js"></script>
    <script src="/RIT/js/jquery.cookie.js"></script>
    <script src="/RIT/js/tableTools/js/TableTools.min.js"></script>
    <script src="/RIT/js/custom.js"></script><script src="js/demo.js"></script>
    <script src="/RIT/js/iconfont.js"></script>
    <style>
        b{color: rgb(26, 115, 212);}
    </style>
</body>

</html>
<%
} else {
%>
<script type="text/javascript">
                                            alert("You Are Not Authorised");
                                            window.history.back();
</script>
<%
            }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>
